from django.db import models

from utils.basemodel import BaseModel


class Nav(BaseModel):

    name = models.CharField(max_length=50, verbose_name='名称')
    url = models.CharField(max_length=200, verbose_name='链接')
    ishttp = models.BooleanField(default=False, verbose_name='是否使用http链接')
    position = models.IntegerField(default=1, verbose_name='位置')

    class Meta:
        db_table = 'fgnav'
        verbose_name = '导航'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name

class Banner(BaseModel):
    title = models.CharField(max_length=50, verbose_name='图片名称')
    ishttp = models.BooleanField(default=False, verbose_name='是否使用http链接')
    imgurl = models.CharField(max_length=200, verbose_name='图片链接')
    url = models.CharField(max_length=200, verbose_name='链接')
    class Meta:
        db_table = 'fgbanner'
        verbose_name = '轮播图'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.title
